//
//  SYComposeButton.swift
//  SYWeibo
//
//  Created by Eric on 16/7/28.
//  Copyright © 2016年 Eric. All rights reserved.
//

import UIKit

class SYComposeButton: UIButton {
    // 模型
    var composeButtonInfo: SYComposeButtonInfo?
    
    //去除高亮状态
    override var highlighted: Bool{
        get{
            
        return false
        
        }
        set{
        
        
        }

    }

    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
        
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    //MARK :  -设置视图
    private func setupUI(){
        //设置 imageView        contentMode : 对加载的图片不做处理  多出的部分 系统自动剪切
        imageView?.contentMode = .Center
        //设置 title
        titleLabel?.textAlignment = .Center
        titleLabel?.font = UIFont.systemFontOfSize(15)
        setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
        
        
    }
    
    
    override func layoutSubviews() {
        super.layoutSubviews()
        //设置imageView
        imageView?.frame = CGRect(x: 0, y: 0, width: self.frame.width, height: self.frame.width)
        //设置title
        titleLabel?.frame = CGRect(x: 0, y: self.frame.width, width: self.frame.width, height: self.frame.height - self.frame.width)
    }

}
